#!/bin/sh
source /etc/profile
if ! command -v x11vnc &>/dev/null; then
    echo "x11vnc 未安装，正在安装..."
    echo "$platform4_linuxPassword" | sudo -S -k apt-get update
    echo "$platform4_linuxPassword" | sudo -S -k apt-get install -y x11vnc
    echo "x11vnc 安装完成。"
else
    echo "x11vnc 已安装。"
fi
# 确保服务启动
x11vnc -display :0 -forever -shared -bg -rfbport 5900 >/dev/null 2>&1
if pgrep -x "x11vnc" >/dev/null; then
    echo "x11vnc 启动成功"
else
    echo "x11vnc 启动失败"
fi